/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Samples (how to use):
//     CMessageBox.Show("Test string1", "Title1", MessageBoxButtons.OK, MessageBoxIcon.Information)
//     CMessageBox.Show("Test string2", "Title2", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
//     CMessageBox.Show("Test string3", "Title3", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
//     CMessageBox.Show("Test string4", "Title4", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information)
//     CMessageBox.Show("Test string5", "Title", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information)
//     CMessageBox.Show("Test string6", "Title6", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Information)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// By JOSIP HABJAN; email:jhabjna@net4u.hr; dt:11/2004
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////


using System.Windows.Forms;

namespace VNMessageBox
{
	public sealed class CMessageBox
	{
		public static DialogResult Show(string text)
		{
			return Show(text, string.Empty);
		}

		public static DialogResult Show(string text, string caption)
		{
			return Show(text, caption, MessageBoxButtons.OK);
		}

		public static DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons)
		{
			return Show(text, caption, buttons, MessageBoxIcon.None);
		}

		public static DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon)
		{
			return Show(text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
		}

		public static DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton)
		{
			return Show(text, caption, buttons, icon, defaultButton, (MessageBoxOptions)0);
		}

		public static DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options)
		{
			return Show(null, text, caption, buttons, icon, defaultButton, options);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text)
		{
			return Show(null, text, string.Empty);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption)
		{
			return Show(owner, text, caption, MessageBoxButtons.OK);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons)
		{
			return Show(owner, text, caption, buttons, MessageBoxIcon.None);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon)
		{
			return Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton)
		{
			return Show(owner, text, caption, buttons, icon, defaultButton, (MessageBoxOptions)0);
		}

		public static DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options)
		{
			CSysMsgBoxHook cysymsgbox = new CSysMsgBoxHook();

			cysymsgbox.HookDialog();
			DialogResult res;

			res = MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);

			cysymsgbox.UnHookDialog();
			cysymsgbox = null;

			return res;
		}
	}
}